<?php

require_once '../Library/phpQuery.php';

class Model
{
    function __construct()
    {
        $this->_query = new phpQuery();
    }
    
    static $_instance = null;
    static function getInstance( $file )    
    {
        if( self::$_instance[$file] === null )
        {
            self::$_instance[$file] = new self();
            if( $file )
            {
                self::$_instance[$file]->getFile( $file );
            }
        }
        
        return self::$_instance[$file];
    }
    
    function getFile( $file = null )
    {
        if( $this->_doc == null )
        {
            if( $file == null )
            {
                throw new Exception("file is null, doc doean't create yet.");
            }
            else if( ! is_file( BASE_PATH.'/img/'. $file ) )
            {
                throw new Exception("file doean't exists.");
            }
            
            $this->_doc = phpQuery::newDocumentFile($dir.'/tmall1.htm');
        }
        
        return $this->_doc;
    }
    
    function crawler()
    {
    }
    
    function getInfo( $model )
    {
        return 
    }
}